jQuery(function(){
jQuery(".item-input input").focus(function(){
	jQuery(".error-box").css("visibility","hidden");
	if(jQuery(this).val()==""||jQuery(this).val()==jQuery(this).siblings("label").text()){
		jQuery(this).siblings("label").css("visibility","hidden");
	}
}).blur(function(){
	if(jQuery(this).val()==""||jQuery(this).val()==jQuery(this).siblings("label").text()){
		jQuery(this).siblings("label").css("visibility","visible");
	}
});
jQuery("form[name=loginForm]").submit(function(){
		var _1=jQuery("#email");
		var _2=jQuery("#password");
		if(_1.val==""||_1.val()=="\u6ce8\u518c\u90ae\u7bb1"||_2.val()==""||_2.val()=="\u8f93\u5165\u5bc6\u7801"){
			jQuery(".error-box").css("visibility","visible");
			return false;
		}
		return true;
	});
});
jQuery(function(){
	jQuery(".login-bg img").bind("load",function(){
		var _3=this;
		var _4=_3.naturalWidth||_3.width;
		var _5=_3.naturalHeight||_3.height;
		var _6=950;
		var _7=(_5*_6)/_4;
		if(_7<490){
		_7=490;
		_6=(_4*_6)/_5;
		}
		_3.style.width=_6+"px";
		_3.style.height=_7+"px";
		_3.style.visibility="visible";
	});
});

$(window).load(function(){
	var reg = new RegExp("(^|\\?|&)"+ "redirectUrl" +"=([^&]*)( \\s|&|$)", "i");
	if (reg.test(location.href)){
		document.getElementById('redirectUrl').value=unescape(RegExp.$2.replace(/\+/g, " "));
	}
	if(hasCookie(cookie_name)){
		location.href = document.getElementById('redirectUrl').value;
	}
});

$(document).ready(function() {
	var cookie_name = "iqqusr";
	$("#autologin").onclick(function(){
		if(!hasCookie(cookie_name)){
			setCookie(cookie_name, 1, 30*60);
		}
	});
}

function hasCookie(c_name){
	if (document.cookie.length>0){
		return (document.cookie.indexOf(c_name + "=") != -1);
		if (c_start!=-1){ 
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1){
				c_end=document.cookie.length;
			}
			return unescape(document.cookie.substring(c_start,c_end))
		} 
  }
}

function getCookie(){
	if (document.cookie.length>0){
		var c_start = document.cookie.indexOf(c_name + "=")
		if ( c_start != -1 ){ 
			c_start = c_start + c_name.length+1;
			c_end = document.cookie.indexOf(";",c_start);
			if (c_end == -1){
				c_end = document.cookie.length;
			}
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}

function setCookie(c_name, c_value, s_expire){
    var sec = s_expire; 
    var exp  = new Date(); 
    exp.setTime(exp.getTime() + sec*1000);
    document.cookie = c_name + "="+ escape (c_value) + ";expires=" + exp.toGMTString();
}